import request from '@/utils/request'

//获取用户列表
export const reqUserList = (page, limit, username) => {
  return request.get(`/admin/acl/user` + `/${page}/${limit}`, {
    params: {
      username
    }
  })
};

//添加和修改用户
export const reqAddorUpdateUser = (user) => {
  if (user.id) {
    return request({
      url: '/admin/acl/user/update',
      method: 'put',
      data: user
    })
  } else {
    return request({
      url: '/admin/acl/user/save',
      method: 'post',
      data: user
    })
  }
}

//删除用户
export const reqDeleteUser = (id) => request({
  url: `/admin/acl/user/remove/${id}`,
  method: 'delete'
})


//批量删除用户
export const reqDeleteUsers = (idList) => request({
  url: `/admin/acl/user/batchRemove`,
  method: 'post',
  data: idList
})